#************************************************************************
#it will compile simple sock programing ,whitch include Client and Server
#Date:          2020-1027
#Author:        mengziyue
#***************************************************************************************

SRC_DIR=./src
OBJ_DIR=./obj
BIN_DIR=./bin

COMPLIER=g++
COMP_OPT= -g -Wall -c -o $@

LINKER=g++
LINK_OPT=-g -o $@

LIB_EXT=a
OBJ_EXT=o

DEL=rm
DIR=ls

CLIENT_LIBS=$(LIB_DIR)/client.$(LIB_EXT)
SERVER_LIBS=$(LIB_DIR)/server.$(LIB_EXT)

all:$(BIN_DIR)/client $(BIN_DIR)/server

$(BIN_DIR)/client:$(OBJ_DIR)/client.$(OBJ_EXT)
	$(LINKER) $(LINK_OPT)  $(OBJ_DIR)/client.$(OBJ_EXT)

$(OBJ_DIR)/client.$(OBJ_EXT):$(SRC_DIR)/client.cpp
	$(COMPLIER) $(COMP_OPT) $<

$(BIN_DIR)/server:$(OBJ_DIR)/server.$(OBJ_EXT)
	$(LINKER) $(LINK_OPT)  $(OBJ_DIR)/server.$(OBJ_EXT)

$(OBJ_DIR)/server.$(OBJ_EXT):$(SRC_DIR)/server.cpp
	$(COMPLIER) $(COMP_OPT) $(SRC_DIR)/server.cpp

clean:
	$(DEL) $(OBJ_DIR)/*.$(OBJ_EXT)
	$(DEL) $(BIN_DIR)/client $(BIN_DIR)/server

